home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / pc_board / nodelk10.zip / README.DOC < prev    next >
Text File  |  1992-04-08  |  8KB  |  196 lines

  1. NODELOCK
  2. --------
  3.  
  4. Purpose:  This utility is designed for in-house network setups using PCBoard
  5. v14.5a.  In v14.5a the /FLOAT environment switch was added to make setup 
  6. easier for such systems.  However, one drawback of the /FLOAT switch is that
  7. if you want to put all of the user specific files (PCBOARD.SYS) on the
  8. server then you would run into problems.  You may want to keep these files
  9. on the server for security reasons, because some of the workstations might
  10. not have hard drives, or your network does not provide a unique directory
  11. for each user.
  12.  
  13. NODELOCK allows you to create a lock file for a node when it is in use.
  14. When that lock file exists no other workstation can access that node until
  15. the node is unlocked.  If a node is locked then NODELOCK will try and find
  16. a free node.  If all of the specified nodes are locked then NODELOCK will
  17. print a message that notifies the user that all nodes are busy.
  18.  
  19. Syntax:  NODELOCK <lockdir> <startnode> <maxnodes> <minutes>
  20.  
  21.          
  22.          lockdir:    This is the directory where you want to store
  23.                      the lock files.  Examples:
  24.                     
  25.                         C:\LOCKS
  26.                         H:\LOCKS
  27.                         G:\PCB\LOCKS
  28.                         
  29.                      If you specify an invalid directory (i.e. it
  30.                      does not exist) then NODELOCK will report
  31.                      that all nodes are busy.
  32.                       
  33.          startnode:  This is the first node to start searching for
  34.                      or to create lock files for.
  35.                      
  36.          
  37.          maxnodes:   The maximum node number to search for or to 
  38.                      create a lock file.  This value must be less
  39.                      than or equal to the number of nodes your copy
  40.                      of PCBoard supports.  For example if you have
  41.                      /E25 then do not set this value higher than 25.
  42.                      
  43.          minutes:    Sometimes a user may not exit properly and 
  44.                      therefore a lock file is left even though there
  45.                      is nobody on the node.  This parameter is the
  46.                      maximum length of time (in minutes) that a lock
  47.                      is considered valid.
  48.                      
  49.                      You will want this value to be high enough that
  50.                      if someone is still online that NODELOCK does
  51.                      not think it is an invalid lock and try to use
  52.                      that node.  For example if most of your users
  53.                      can spend 90 minutes online then you may want
  54.                      to set this value to 120 just to be safe.
  55.                      
  56.                      If all nodes are busy then NODELOCK will check
  57.                      to see if any of the locks are invalid because
  58.                      they are two old.  If one is found to be too 
  59.                      old then it will be deleted and the new caller
  60.                      will be logged into that free node.
  61.                      
  62.  
  63. UNLOCK
  64. ------
  65.  
  66. Purpose:  Removes the locks created by the NODELOCK program.  UNLOCK is
  67.           intelligent enough to know which node to unlock.
  68.           
  69. Syntax:   UNLOCK <lockdir>
  70.  
  71.           lockdir:  The location where the lock files can be found
  72.                     on disk.  You should use the same lockdir for
  73.                     the UNLOCK program as you did for the NODELOCK
  74.                     program.
  75.           
  76.           If you specify an incorrect or invalid directory or a
  77.           directory which does not contain the lock files then
  78.           UNLOCK will report "Unable to remove lock for node x".
  79.           Again, make sure that you specify the same lockdir value
  80.           for UNLOCK and NODELOCK.
  81.           
  82. Installing NODELOCK:
  83. --------------------
  84.  
  85. To install NODELOCK you need to have a copy of PCBoard already running
  86. and most likely on the server.  If you want to create "node" directories
  87. for each node so that you can use them to store the user specific files.
  88. Each node directory would most likely contain the node number.
  89.  
  90. For example, if PCBoard is on the server in the \PCB directory then
  91. your tree might look like this:
  92.  
  93.    \PCB
  94.      !
  95.      +-- NODE0001
  96.      |
  97.      +-- NODE0002
  98.      |
  99.      +-- NODE0003
  100.      |
  101.      +-- NODE0004
  102.      |
  103.      +-- NODE0005
  104.      |
  105.      --- NODE0006
  106.      
  107. Now you need to modify your BOARD.BAT so that it runs NODELOCK and
  108. UNLOCK.  This will be the BOARD.BAT that everyone will run so make sure
  109. that everyone you wish to have access to the BBS also has access to this
  110. new BOARD.BAT file.
  111.  
  112. Here is an example BOARD.BAT:
  113.  
  114.    @echo off
  115.    set node=0000
  116.    nodelock f:\locks 5 10 240
  117.    if errorlevel == 99 goto abort
  118.    rem --------------------------------------
  119.    rem Change to the node drive and directory
  120.    rem --------------------------------------
  121.    f:
  122.    cd \pcb\node%NODE%
  123.    rem ---------------------------------------------------
  124.    rem Delete pcboard.sys in case the node was a hung node
  125.    rem ---------------------------------------------------
  126.    del pcboard.sys
  127.    set pcb=/main /swap /node:%NODE%
  128.    set dszlog=pcbdsz.log
  129.    if exist remote.bat rename remote.bat remote.sys
  130.    if exist event.bat rename event.bat event.sys
  131.    if exist door.bat del door.bat
  132.    if exist endpcb del endpcb
  133.    pcb145 /localon /file:f:\pcb\pcboard.dat
  134.    if exist remote.bat remote
  135.    if exist door.bat door
  136.    if exist event.bat event
  137.    if exist endpcb goto end
  138.    board
  139.    :end
  140.    unlock f:\locks
  141.    :busy
  142.    cd\
  143.  
  144. The above sample creates an environment variable called NODE and sets it to
  145. 0000.  It is important that you define at least four 0s so that you can 
  146. guarantee that there is enough room for the NODELOCK program to set the
  147. NODE environment variable to reflect the true node number.
  148.  
  149. Next,  the NODELOCK program is run.  In this example the locks directory
  150. is F:\LOCKS but you will probably need to change it to a different location
  151. based on your network setup.  NODELOCK will scan to see if nodes 5 through
  152. 10 are free.  A lock is considered invalid if it is more than 240 minutes
  153. (4 hours) old.
  154.  
  155. If all nodes were determined to be busy then NODELOCK will exit with an
  156. errorlevel of 99.  In the example batch file above if the errorlevel is
  157. 99 then the batch file branches to the "busy" label which simply changes
  158. to the root directory and ends the batch file.
  159.  
  160. The next step in the batch file is to change to one of the node directories.
  161. We will know which directory to change to because the NODE environment
  162. variable has been set.  Before we change to the node directory we first
  163. change to the appropriate drive.  This assures us that we are on the correct
  164. drive.  If not then serious problems could arise when you are unable to
  165. change to the node directory.  The line "cd \pcb\node%NODE%" is the line
  166. that actually changes the directory. 
  167.  
  168. Once we change to the directory if there is a PCBOARD.SYS file already in
  169. the directory then the "if exist pcboard.sys del pcboard.sys" line will
  170. delete the file.  There should only be a stray PCBOARD.SYS file if the
  171. node was a hung and NODELOCK declared the lock invalid.
  172.  
  173. Next we set the PCB environment variable with a few of PCBoard's
  174. environment switches.  The /main and /swap environment variables are
  175. covered in the documentation for PCBoard.  The /node switch tells PCBoard
  176. which node it should use.
  177.  
  178. PCBoard is then loaded.  We use the /localon parameter so that the user
  179. is logged straight in and goes to the "Do you want graphics" prompt.  The
  180. /file parameter is used to point to the location of PCBOARD.DAT.  This 
  181. should probably be the same location as your PCBoard installation on the
  182. server.
  183.  
  184. Finally, when a user logs off, we go to the end label and so UNLOCK is
  185. ran and the lock is removed and that node becomes free and waits for the
  186. next caller.
  187.  
  188. Common questions:
  189. -----------------
  190.  
  191. Is there any "window" when two users could try to occupy the same node and
  192. therefore cause conflicts?
  193.  
  194. Yes, however that window (on a 386-33) is far less than 1/20th of a second.
  195. This window is small enough that should probably not incur any problems.
  196.